﻿@using Microsoft.AspNetCore.Identity;

@model IEnumerable<IdentityRole>
    @{
    ViewData["Title"] = "角色管理";
    Layout = "~/Views/Shared/_Layout.cshtml";
    }

    <h1>@ViewData["Title"]</h1>
    <a asp-action="Create" class=" btn btn-outline-success">添加角色</a>
    <table class="table">
        <thead>
            <tr>
                <td>ID</td>
                <td>角色名称</td>
                <td>操作</td>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model)
            {
            <tr>
                <td>@item.Id</td>
                <td>@item.Name</td>
                <td class="row">
                    <form asp-action="Delete" asp-route-id="@item.Id" method="post">
                        <button type="submit" class="btn btn-danger mr-2" onclick="return confirm('确定删除?')">删除</button> 
                        <span asp-validation-for="@item.Id"></span>
                    </form>
                    <form asp-action="Detail" asp-route-Id="@item.Id" method="post">
                        <button type="submit" class="btn btn-secondary">详细</button>
                        <span asp-validation-for="@item.Id"></span>
                    </form>


                </td>
            </tr>
            }

        </tbody>
    </table>
